package com.wwtech.epp.ui.activity.work.module;

import android.net.Uri;

import com.wwtech.epp.data.api.HttpAPIWrapper;
import com.wwtech.epp.db.Friend;
import com.wwtech.epp.entity.ProjectTask;
import com.wwtech.epp.ui.activity.base.ActivityScope;
import com.wwtech.epp.ui.activity.work.NewProjectActivity;
import com.wwtech.epp.ui.activity.work.contract.NewProjectContract;
import com.wwtech.epp.ui.activity.work.presenter.NewProjectPresenter;
import com.wwtech.epp.ui.adapter.work.ProjectAdapter;
import com.wwtech.epp.ui.adapter.work.ProjectTaskAdapter;

import java.util.ArrayList;

import dagger.Module;
import dagger.Provides;

/**
 * @author hzp
 * @Package com.wwtech.epp.ui.activity.work
 * @Description: The moduele of NewProjectActivity, provide field for NewProjectActivity
 * @date 2017/09/01 22:09:47
 */
@Module
public class NewProjectModule {
    private final NewProjectContract.View mView;


    public NewProjectModule(NewProjectContract.View view) {
        this.mView = view;
    }

    @Provides
    @ActivityScope
    public NewProjectPresenter provideNewProjectPresenter(HttpAPIWrapper httpAPIWrapper, NewProjectActivity mActivity) {
        return new NewProjectPresenter(httpAPIWrapper, mView, mActivity);
    }

    @Provides
    @ActivityScope
    public NewProjectActivity provideNewProjectActivity() {
        return (NewProjectActivity) mView;
    }

    @Provides
    @ActivityScope
    public ArrayList<Friend> provideProjectMember() {
        ArrayList<Friend> list = new ArrayList<>();
        Friend friend = new Friend("", "-1", "", Uri.parse(""));
        friend.setUserId("-1");
        list.add(friend);
        return list;
    }

    @Provides
    @ActivityScope
    public ArrayList<ProjectTask> provideProjectTask() {
        ArrayList<ProjectTask> list = new ArrayList<>();
        return list;
    }

    @Provides
    @ActivityScope
    public ProjectTaskAdapter provideProjectTaskAdapter(ArrayList<ProjectTask> data) {
        return new ProjectTaskAdapter(data);
    }

    @Provides
    @ActivityScope
    public ProjectAdapter provideProjectAdapter(ArrayList<Friend> data) {
        return new ProjectAdapter(data);
    }
}